#pragma once
#include "WindowManager.h"
#include "Ground.h"
#include "NPC.h"
#include <Box2D/Box2D.h>
#include <stdio.h>
#include <windows.h>

#include "Thor\Animation.hpp"


class Character
{

private:
	b2World* world;
	WindowManager* window;
	b2Body* body;
	bool lockMovement;
	sf::Clock jumpTime;
	int numFootContacts;

	void addFrames(thor::FrameAnimation& animation, int x, int yFirst, int yLast, float duration = 1.f);

	thor::Animator<sf::Sprite, std::string> animator;

	sf::Clock clock;
	sf::Sprite sprite;
	sf::Image image;
	sf::Texture texture;

	bool goingRight;
	bool jumping;
	

public:
	Character(b2World*, WindowManager*);
	~Character(void);

	void drawCharacter();
	void addForce(sf::Vector2i);
	void jump();
	bool checkNPC(NPC*, bool);
	float getRadius(void);
	b2Vec2 getPosition(void);
	void unlockMovement(void);

	void addNumFootContacts(int);

	void setPosition(sf::Vector2f);

	void stopMovement(void);

	bool canMove(void);
};



